export default function (validKeys) {
  return function (obj) {
    const filteredObj = {};
    for (const key in obj) {
      if (validKeys.includes(key) && obj[key] !== undefined) {
        filteredObj[key] = obj[key];
      }
    }
    return filteredObj;
  };
}
